package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.gson.Gson;
import com.hsc.pcddfivepcdd.R;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.db.DatabaseHelper;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.BaseDataObject;
import com.hsc.yalebao.model.IsBoundPhoneBean;
import com.hsc.yalebao.model.IsSetPayPasswordBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.IOHelper;
import com.hsc.yalebao.tools.SharedPreferencesUtil;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.hsc.yalebao.weight.MyDialog1;
import com.zhy.http.okhttp.callback.StringCallback;

import java.io.File;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;

import okhttp3.Call;

public class SetActivity extends BaseActivity {
    protected static final String TAG = "SetActivity";
    private File cacheDir;
    private String cacheSize = "";
    private Context context;
    private ImageView iv_title_right;
    private LinearLayout ll_01;
    private LinearLayout ll_02;
    private LinearLayout ll_03;
    private LinearLayout ll_04;
    private LinearLayout ll_05;
    private LinearLayout ll_06;
    private int memberid;
    private MyDialog1 myDialog1;
    View.OnClickListener onClickListener = new View.OnClickListener() {
        public void onClick(View paramAnonymousView) {
            switch (paramAnonymousView.getId()) {
                case 2131099704:
                default:
                    return;
                case 2131099699:
            }
            CustomApplication.app.finishActivity(SetActivity.this);
        }
    };
    private View view_title;

    private void totalCacheSize() {
        long l = IOHelper.totalFileSize(this.cacheDir);
        this.cacheSize = new DecimalFormat("#,##0.00").format(l / 1048576.0D);
    }

    public void Isboundphone() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("memberid", this.memberid);
        LogUtils.d("SetActivity", "URL:" + AppConstants.URL_GET_TELEPHONESTATE);
        RequestNet.get(this.context, AppConstants.URL_GET_TELEPHONESTATE, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                LogUtils.e("SetActivity", "获取失败,获取提现记录:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                if (UiUtil.IsValueEmpty(paramAnonymousString))
                    LogUtils.d("SetActivity", "为空时result:" + paramAnonymousString);
                IsBoundPhoneBean localIsBoundPhoneBean;
                do {
                    return;
                    Gson localGson = new Gson();
                    try {
                        localIsBoundPhoneBean = (IsBoundPhoneBean) localGson.fromJson(paramAnonymousString, IsBoundPhoneBean.class);
                        if (localIsBoundPhoneBean == null) {
                            LogUtils.e("SetActivity", "IsSetPayPasswordBean，获取失败");
                            return;
                        }
                    } catch (Exception localException) {
                        while (true) {
                            localException.printStackTrace();
                            localIsBoundPhoneBean = null;
                        }
                        if (localIsBoundPhoneBean.getFlag() == 0) {
                            SetActivity.this.myDialog1.setMessage(localIsBoundPhoneBean.getMsg());
                            SetActivity.this.myDialog1.show();
                            SetActivity.this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                                public void onClick(View paramAnonymous2View) {
                                    SetActivity.this.myDialog1.dismiss();
                                }
                            });
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -2) {
                            SetActivity.this.showDownWireDialog();
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -3) {
                            SetActivity.this.ShowFengjinDialog();
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -4) {
                            SetActivity.activityStack.backToMain(MainActivity.class, SetActivity.this.context);
                            return;
                        }
                    }
                }
                while (localIsBoundPhoneBean.getFlag() != 1);
                if (localIsBoundPhoneBean.getState() == 0) {
                    SetActivity.this.Issetpaypassword();
                    return;
                }
                SetActivity.this.myDialog1.setMessage("为了您的资金安全，请绑定手机号");
                SetActivity.this.myDialog1.show();
                SetActivity.this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View paramAnonymous2View) {
                        SetActivity.this.startActivity(new Intent(SetActivity.this, BoundPhoneActivity.class));
                        SetActivity.this.myDialog1.dismiss();
                    }
                });
            }
        });
    }

    public void Isboundphone1() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("memberid", this.memberid);
        LogUtils.d("SetActivity", "URL:" + AppConstants.URL_GET_TELEPHONESTATE);
        RequestNet.get(this.context, AppConstants.URL_GET_TELEPHONESTATE, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                LogUtils.e("SetActivity", "获取失败,获取提现记录:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                if (UiUtil.IsValueEmpty(paramAnonymousString))
                    LogUtils.d("SetActivity", "为空时result:" + paramAnonymousString);
                IsBoundPhoneBean localIsBoundPhoneBean;
                do {
                    return;
                    Gson localGson = new Gson();
                    try {
                        localIsBoundPhoneBean = (IsBoundPhoneBean) localGson.fromJson(paramAnonymousString, IsBoundPhoneBean.class);
                        if (localIsBoundPhoneBean == null) {
                            LogUtils.e("SetActivity", "IsSetPayPasswordBean，获取失败");
                            return;
                        }
                    } catch (Exception localException) {
                        while (true) {
                            localException.printStackTrace();
                            localIsBoundPhoneBean = null;
                        }
                        if (localIsBoundPhoneBean.getFlag() == 0) {
                            SetActivity.this.myDialog1.setMessage(localIsBoundPhoneBean.getMsg());
                            SetActivity.this.myDialog1.show();
                            SetActivity.this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                                public void onClick(View paramAnonymous2View) {
                                    SetActivity.this.myDialog1.dismiss();
                                }
                            });
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -2) {
                            SetActivity.this.showDownWireDialog();
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -3) {
                            SetActivity.this.ShowFengjinDialog();
                            return;
                        }
                        if (localIsBoundPhoneBean.getFlag() == -4) {
                            SetActivity.activityStack.backToMain(MainActivity.class, SetActivity.this.context);
                            return;
                        }
                    }
                }
                while (localIsBoundPhoneBean.getFlag() != 1);
                if (localIsBoundPhoneBean.getState() == 0) {
                    SetActivity.this.Issetpaypassword1();
                    return;
                }
                SetActivity.this.myDialog1.setMessage("为了您的资金安全，请绑定手机号");
                SetActivity.this.myDialog1.show();
                SetActivity.this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View paramAnonymous2View) {
                        SetActivity.this.startActivity(new Intent(SetActivity.this, BoundPhoneActivity.class));
                        SetActivity.this.myDialog1.dismiss();
                    }
                });
            }
        });
    }

    public void Issetpaypassword() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("memberid", this.memberid);
        LogUtils.d("SetActivity", "URL:" + AppConstants.URL_GET_ISSETPAYPASSWORD);
        RequestNet.get(this.context, AppConstants.URL_GET_ISSETPAYPASSWORD, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                LogUtils.e("SetActivity", "获取失败,获取提现记录:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                if (UiUtil.IsValueEmpty(paramAnonymousString))
                    LogUtils.d("SetActivity", "为空时result:" + paramAnonymousString);
                IsSetPayPasswordBean localIsSetPayPasswordBean;
                do {
                    return;
                    Gson localGson = new Gson();
                    try {
                        localIsSetPayPasswordBean = (IsSetPayPasswordBean) localGson.fromJson(paramAnonymousString, IsSetPayPasswordBean.class);
                        if (localIsSetPayPasswordBean == null) {
                            LogUtils.e("SetActivity", "IsSetPayPasswordBean，获取失败");
                            return;
                        }
                    } catch (Exception localException) {
                        while (true) {
                            localException.printStackTrace();
                            localIsSetPayPasswordBean = null;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == 0) {
                            SetActivity.this.startActivity(new Intent(SetActivity.this, SafeCodeActivity.class));
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -2) {
                            SetActivity.this.showDownWireDialog();
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -3) {
                            SetActivity.this.ShowFengjinDialog();
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -4) {
                            SetActivity.activityStack.backToMain(MainActivity.class, SetActivity.this.context);
                            return;
                        }
                    }
                }
                while (localIsSetPayPasswordBean.getFlag() != 1);
                Intent localIntent = new Intent(SetActivity.this, ChangePayPasswordActivity.class);
                SetActivity.this.startActivity(localIntent);
            }
        });
    }

    public void Issetpaypassword1() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("memberid", this.memberid);
        LogUtils.d("SetActivity", "URL:" + AppConstants.URL_GET_ISSETPAYPASSWORD);
        showLoadingDialog();
        RequestNet.get(this.context, AppConstants.URL_GET_ISSETPAYPASSWORD, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                SetActivity.this.dismissLoadingDialog();
                LogUtils.e("SetActivity", "获取失败,获取提现记录:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                SetActivity.this.dismissLoadingDialog();
                if (UiUtil.IsValueEmpty(paramAnonymousString))
                    LogUtils.d("SetActivity", "为空时result:" + paramAnonymousString);
                IsSetPayPasswordBean localIsSetPayPasswordBean;
                do {
                    return;
                    Gson localGson = new Gson();
                    try {
                        localIsSetPayPasswordBean = (IsSetPayPasswordBean) localGson.fromJson(paramAnonymousString, IsSetPayPasswordBean.class);
                        if (localIsSetPayPasswordBean == null) {
                            LogUtils.e("SetActivity", "IsSetPayPasswordBean，获取失败");
                            return;
                        }
                    } catch (Exception localException) {
                        while (true) {
                            localException.printStackTrace();
                            localIsSetPayPasswordBean = null;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == 0) {
                            SetActivity.this.myDialog1.setMessage("请先设置您的提现密码");
                            SetActivity.this.myDialog1.show();
                            SetActivity.this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                                public void onClick(View paramAnonymous2View) {
                                    SetActivity.this.startActivity(new Intent(SetActivity.this, SafeCodeActivity.class));
                                    SetActivity.this.myDialog1.dismiss();
                                }
                            });
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -2) {
                            SetActivity.this.showDownWireDialog();
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -3) {
                            SetActivity.this.ShowFengjinDialog();
                            return;
                        }
                        if (localIsSetPayPasswordBean.getFlag() == -4) {
                            SetActivity.activityStack.backToMain(MainActivity.class, SetActivity.this.context);
                            return;
                        }
                    }
                }
                while (localIsSetPayPasswordBean.getFlag() != 1);
                Intent localIntent = new Intent(SetActivity.this, BoundBankCardActivity.class);
                SetActivity.this.startActivity(localIntent);
            }
        });
    }

    public void Logout() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("memberid", this.memberid);
        LogUtils.d("SetActivity", "URL:" + AppConstants.URL_LOGOUT);
        CustomApplication.app.isLogin = false;
        CustomApplication.app.preferencesUtil.setValue(AppConstants.LOGIN_PWD, "");
        CustomApplication.app.preferencesUtil.setValue(AppConstants.LOGIN_TYPE, "0");
        MainActivity.mainActivity.performClickBtn(0);
        CustomApplication.app.userBaseBean = null;
        RequestNet.get(this.context, AppConstants.URL_LOGOUT, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                SetActivity.this.dismissLoadingDialog();
                LogUtils.e("SetActivity", "获取失败,getUserAmount-result:" + paramAnonymousException);
                CustomApplication.app.finishActivity(SetActivity.this);
            }

            public void onResponse(String paramAnonymousString) {
                SetActivity.this.dismissLoadingDialog();
                LogUtils.d("SetActivity", "result:" + paramAnonymousString);
                Gson localGson = new Gson();
                try {
                    localBaseDataObject = (BaseDataObject) localGson.fromJson(paramAnonymousString, BaseDataObject.class);
                    if (localBaseDataObject == null)
                        return;
                } catch (Exception localException) {
                    BaseDataObject localBaseDataObject;
                    while (true) {
                        localException.printStackTrace();
                        localBaseDataObject = null;
                    }
                    if (localBaseDataObject.getFlag() != 1)
                        SetActivity.this.ShowDialog1(localBaseDataObject.getMsg());
                    CustomApplication.app.finishActivity(SetActivity.this);
                }
            }
        });
    }

    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.activity_set);
        CustomApplication.app.addActivity(this);
        this.context = this;
        setTitle(8, 0, 2130837809, "设置", 0, 8, 8, 0, true);
        this.ll_01 = ((LinearLayout) findViewById(2131099964));
        this.ll_02 = ((LinearLayout) findViewById(2131099965));
        this.ll_03 = ((LinearLayout) findViewById(2131099966));
        this.ll_04 = ((LinearLayout) findViewById(2131099967));
        this.ll_05 = ((LinearLayout) findViewById(2131099968));
        this.ll_06 = ((LinearLayout) findViewById(2131099969));
        this.ll_01.setOnClickListener(new MyOnClickListener());
        this.ll_02.setOnClickListener(new MyOnClickListener());
        this.ll_03.setOnClickListener(new MyOnClickListener());
        this.ll_04.setOnClickListener(new MyOnClickListener());
        this.ll_05.setOnClickListener(new MyOnClickListener());
        this.ll_06.setOnClickListener(new MyOnClickListener());
        this.cacheDir = new File(DatabaseHelper.CACHE_DIR);
        totalCacheSize();
        this.myDialog1 = new MyDialog1(this.context);
        if (CustomApplication.app.userBaseBean != null)
            this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    }

    @SuppressLint({"NewApi"})
    public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean) {
        View localView = findViewById(2131099716);
        if (paramBoolean)
            localView.setVisibility(0);
        while (true) {
            ((TextView) localView.findViewById(2131099701)).setText(paramString);
            ((TextView) localView.findViewById(2131099700)).setVisibility(paramInt1);
            ImageView localImageView = (ImageView) localView.findViewById(2131099699);
            localImageView.setVisibility(paramInt2);
            localImageView.setOnClickListener(this.onClickListener);
            localImageView.setImageResource(paramInt3);
            TextView localTextView = (TextView) localView.findViewById(2131099702);
            localTextView.setVisibility(paramInt5);
            localTextView.setOnClickListener(this.onClickListener);
            this.iv_title_right = ((ImageView) localView.findViewById(2131099704));
            this.iv_title_right.setVisibility(paramInt6);
            this.iv_title_right.setOnClickListener(this.onClickListener);
            this.iv_title_right.setImageResource(paramInt7);
            return;
            localView.setVisibility(8);
        }
    }

    class MyOnClickListener
            implements View.OnClickListener {
        MyOnClickListener() {
        }

        public void onClick(View paramView) {
            switch (paramView.getId()) {
                default:
                    return;
                case 2131099964:
                    SetActivity.this.Isboundphone1();
                    return;
                case 2131099965:
                    Intent localIntent2 = new Intent(SetActivity.this, PassWordActivity.class);
                    SetActivity.this.startActivity(localIntent2);
                    return;
                case 2131099966:
                    SetActivity.this.Isboundphone();
                    return;
                case 2131099967:
                    Intent localIntent1 = new Intent(SetActivity.this, BoundPhoneActivity.class);
                    SetActivity.this.startActivity(localIntent1);
                    return;
                case 2131099968:
                    IOHelper.deleteAllFiles(SetActivity.this.cacheDir);
                    SetActivity.this.ShowDialog1("已清除缓存" + SetActivity.this.cacheSize + "M");
                    SetActivity.this.totalCacheSize();
                    return;
                case 2131099969:
            }
            SetActivity.this.Logout();
        }
    }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.SetActivity
 * JD-Core Version:    0.6.2
 */